#include "mainwindow.h"

#include <QApplication>
#include <QtDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    //首次生成配置文件
    QSettings setting(QCoreApplication::applicationDirPath() + QString("/config.ini"), QSettings::IniFormat);

    setting.beginGroup("config"); //beginGroup与下面endGroup 相对应，“config”是标记
    if (setting.value("status_bar").isNull())
        setting.setValue("status_bar", QVariant("1"));
    if (setting.value("auto_go_line").isNull())
        setting.setValue("auto_go_line", QVariant("0"));
    setting.endGroup();

    MainWindow w;
    QScreen *screen = QApplication::primaryScreen(); //获取当前屏幕的大小
    //居中显示
    w.move((screen->geometry().width() - w.width()) / 2, (screen->geometry().height() - w.height()) / 2);
    w.show();
    return a.exec();
}
